/*
 *
 *  * Copyright (c) iwindplus Technologies Co., Ltd.2024-2030, All rights reserved.
 *
 *
 */

package com.iwindplus.base.alert;

import com.iwindplus.base.alert.domain.property.AlertProperty;
import com.iwindplus.base.alert.service.AlertFeishuService;
import com.iwindplus.base.alert.service.impl.AlertFeishuServiceImpl;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * 告警配置（对接第三方消息系统）.
 *
 * @author zengdegui
 * @since 2025/11/23 21:15
 */
@Slf4j
@Configuration
@EnableConfigurationProperties(AlertProperty.class)
public class AlertConfiguration {

    /**
     * 创建 AlertFeishuService.
     *
     * @return AlertFeishuService
     */
    @ConditionalOnProperty(prefix = "alert.feishu", name = "enabled", havingValue = "true")
    @Bean
    public AlertFeishuService alertFeishuService() {
        AlertFeishuServiceImpl alertFeishuService = new AlertFeishuServiceImpl();
        log.info("AlertFeishuService={}", alertFeishuService);
        return alertFeishuService;
    }
}
